////////////////////////////////////////////////////////////
/* MorphNPC Script Original written by Scarface//Odin    //
 *                                                      //
 * This script can be easily edited to be              //
 * used for your server. Throughout the script        //
 * are comments on what each thing does so that      //
 * you can edit this. You can create custom         //
 * teleporting locations and menus.                //
 *                                                //
 * Originally written for use with Moon++        //
 */                                             //
/////////////////////////////////////////////////



#include "StdAfx.h"
#include "Setup.h"

#define MORPH_NPC 55556

#ifdef WIN32
#pragma warning(disable:4018)		// signed/unsigned mismatch in comparison op
#endif

class SCRIPT_DECL MorphNPC : public GossipScript
{
public:
	void GossipHello(Object * pObject, Player* Plr, bool AutoSend);
	void GossipSelectOption(Object * pObject, Player* Plr, uint32 Id, uint32 IntId, const char * Code);
	void GossipEnd(Object * pObject, Player* Plr);
	void Destroy(){ delete this;}
};


void MorphNPC::GossipHello(Object * pObject, Player* Plr, bool AutoSend)
{
	GossipMenu *Menu;
	objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 1, Plr);
	Menu->AddItem(0, "3g: Murky the Murloc", 1);
	Menu->AddItem(0, "50g: MaDusa", 2);
	Menu->AddItem(0, "5g: Fake King of Stormwind", 3);
	Menu->AddItem(0, "5g: Hogger", 4);
	Menu->AddItem(0, "5g: Chicken", 5);
	Menu->AddItem(1, "Gods", 7);
	Menu->AddItem(1, "Leaders/Kings", 8);
	Menu->AddItem(1, "Grunts", 9);
	Menu->AddItem(2, "Famous People", 30);
	Menu->AddItem(10, "De Morph", 10);
	if(AutoSend) Menu->SendTo(Plr);
}

void MorphNPC::GossipEnd(Object * pObject, Player* Plr)
{
	GossipScript::GossipEnd(pObject, Plr);
}

void MorphNPC::GossipSelectOption(Object * pObject, Player* Plr, uint32 Id, uint32 IntId, const char * Code)
{
	Creature * pCreature = (pObject->GetTypeId()==TYPEID_UNIT)?((Creature*)pObject):NULL;
	if(pCreature==NULL) 
		return;

	char* message;
	uint32 displayid;
	int price;
	switch(IntId)
	{
		
	case 1: price = 30000; displayid = 15369; message = "Murky it is!"; 
		break;
		
	case 2: price = 500000; displayid = 20748; message = "AHHH madusa!!!"; 
		break;
		
	case 3: price = 50000; displayid = 11655; message = "So! the FAKE king has arrived"; 
		break;
		
	case 4: price = 50000; displayid = 384; message = "Hogger it is!"; 
		break;
		
	case 5: price = 50000; displayid = 304; message = "Chicken it is!"; 
		break;
		
	case 11: price = 1000000; displayid = 21632; message = "Ah! The Lynx God of the Great AMANI!!"; 
		break;
		
	case 12: price = 1000000; displayid = 21631; message = "Ah! The Bear God of the Great AMANI!!"; 
		break;
		
	case 13: price = 1000000; displayid = 21630; message = "Ah! The Eagle God of the Great AMANI!!";
		break;
	
	case 14: price = 1000000; displayid = 21633; message = "Ah! The DragonHawk God of the Great AMANI!!"; 
		break;
		
	case 15: price = 1000000; displayid = 11656; message = "The Great King of Stormwind has returned!"; 
		break;
		
	case 16: price = 1000000; displayid = 4527; message = "The Great King of Origrimmar has returned!"; 
		break;
		
	case 17: price = 1000000; displayid = 1542; message = "The Great King of Darnassus has returned!"; 
		break;
		
	case 18: price = 1000000; displayid = 3597; message = "The Great King of Iron Forge has returned!"; 
		break;
		
	case 19: price = 1000000; displayid = 4307; message = "The Great King of Thunder Bluff has returned!"; 
		break;
		
	case 20: price = 1000000; displayid = 11657; message = "The Great Queen of Undercity has returned!";
		break;
		
	case 29: price = 1000000; displayid = 7006; message = "The Great King of The Gnomes has returned!";
		break;
		
	case 31: price = 50000; displayid = 8413; message = "EH! MARIO!"; 
		break;
		
	case 32: price = 50000; displayid = 8430; message = "EH! LUIGI!";
		break;
		
	case 33: price = 50000; displayid = 8012; message = "Link! and the geat ocarina! play me a song!";
		break;
		
	case 34: price = 50000; displayid = 18148; message = "YOU WHORE!!"; 
		break;
		
	case 35: price = 50000; displayid = 2591; message = "WoW! these Boots ARE made for walking"; 
		break;
		
	case 22: 

	case 23: 

	case 24: 
		
	case 25: 
		
	case 26: 
		
	case 27: 
		
	case 28:
		
		{
			price = 50000;
			message = "Ah! A mighty Soldier!";
			switch(IntId)
			{
			
			case 22: displayid = 3258; 
				break;
			
			case 23: displayid = 4259; 
				break;
			
			case 24: displayid = 2306; 
				break;
			
			case 25: displayid = 3524; 
				break;
			
			case 26: displayid = 2142; 
				break;
				
			case 27: displayid = 10699; 
				break;
				
			case 28: displayid = 17372; 
				break;
			}
			break;
		}

	case 7: //Gods
		{
			GossipMenu *Menu;
			objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 1, Plr);
			Menu->AddItem(0, "100g:Lynx God", 11);
			Menu->AddItem(0, "100g:Bear God", 12);
			Menu->AddItem(0, "100g:Eagle God", 13);
			Menu->AddItem(0, "100g:Dragonhawk God", 14);
			Menu->AddItem(0, "[Back]", 99);
			Menu->SendTo(Plr);
			price = -1;
		break;
		}


	case 8: //Kings
		{
			GossipMenu *Menu;
			objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 1, Plr);
			Menu->AddItem(0, "100g:True King of Stormwind", 15);
			Menu->AddItem(0, "100g:King of Orgrimmar", 16);
			Menu->AddItem(0, "100g:King of Darnassus ", 17);
			Menu->AddItem(0, "100g:King of Ironforge ", 18);
			Menu->AddItem(0, "100g:King of Thunderbluff ", 19);
			Menu->AddItem(0, "100g:Queen of Undercity ", 20);
			Menu->AddItem(0, "100g:King of Gnomes ", 29);
			Menu->AddItem(0, "[Back]", 99);
			Menu->SendTo(Plr);
			price = -1;
		break;
		}
	
	case 9: //Grunts
		{
			GossipMenu *Menu;
			objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 1, Plr);
			Menu->AddItem(0, "50g:Stormwind", 22);
			Menu->AddItem(0, "50g:Orgrimmar", 23);
			Menu->AddItem(0, "50g:Darnassus ", 24);
			Menu->AddItem(0, "50g:Ironforge ", 25);
			Menu->AddItem(0, "50g:Thunderbluff ", 26);
			Menu->AddItem(0, "50g:Undercity ", 27);
			Menu->AddItem(0, "50g:Exodar ", 28);
			Menu->AddItem(0, "[Back]", 99);
			price = -1;
		break;
		}

	case 10: //Demorph
		{
			pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Your so vain!");
			pCreature->Emote(EMOTE_ONESHOT_CHEER);
			Plr->DeMorph();
			price = -2;
		break;
		}
	
	case 30: //Famous
		{
			GossipMenu *Menu;
			objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 1, Plr);
			Menu->AddItem(3, "50g: Mario", 31);
			Menu->AddItem(3, "50g: Luigi", 32);
			Menu->AddItem(3, "50g: Link", 33);
			Menu->AddItem(3, "50g: Paris Hilton", 34);
			Menu->AddItem(3, "50g: Daisey", 35);
			Menu->AddItem(0, "[Back]", 99);
			Menu->SendTo(Plr);
			price = -1;
		break;
		}

	case 99: //Main Menu
		{
			GossipMenu *Menu;
			objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 1, Plr);
			Menu->AddItem(0, "3g: Murky the Murloc", 1);
			Menu->AddItem(0, "50g: MaDusa", 2);
			Menu->AddItem(0, "5g: Fake King of Stormwind", 3);
			Menu->AddItem(0, "5g: Hogger", 4);
			Menu->AddItem(0, "5g: Chicken", 5);
			Menu->AddItem(1, "Gods", 7);
			Menu->AddItem(1, "Leaders/Kings", 8);
			Menu->AddItem(1, "Grunts", 9);
			Menu->AddItem(2, "Famous People", 30);
			Menu->AddItem(10, "De Morph", 10);
			Menu->SendTo(Plr);
			price = -1;
		break;
		}
	}

	if(price > 0) //They picked a ID
	{
		if (Plr->GetUInt32Value(PLAYER_FIELD_COINAGE) >= price)
		{
			Plr->SetUInt32Value(PLAYER_FIELD_COINAGE, Plr->GetUInt32Value(PLAYER_FIELD_COINAGE) - price);
			pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, message);
			pCreature->Emote(EMOTE_ONESHOT_CHEER);
			Plr->SetUInt32Value(UNIT_FIELD_DISPLAYID, displayid);
		}
		else
		{
			pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "You don't have enough money!");
		}
		Plr->Gossip_Complete();
	}
}

void SetupMorphNPC(ScriptMgr * mgr)
{
GossipScript * gs = (GossipScript*) new MorphNPC();
mgr->register_gossip_script(55556, gs);
}